# Maintainer: Justin Kromlinger <hashworks@archlinux.org>
pkgname=pam-ihosts
pkgver=1.6
pkgrel=1
pkgdesc="A PAM module that provides access control by ip, mac-address, or country-code/region"
license=("GPL3")
arch=("loong64" "x86_64")
depends=("pam")
url='https://github.com/ColumPaget/pam_ihosts'
source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz")
sha256sums=('0d5952395cdfa3824b4f166862b909cbe4162b43052f747b356285cd8135dab3')

prepare() {
	sed -e 's|$(CFLAGS)|$(CFLAGS) $(LDFLAGS) $(CPPFLAGS)|;s| -fno-stack-protector ||' -i "pam_ihosts-${pkgver}/Makefile.in"
	sed '/$(INSTALL) -d $(DESTDIR)$(bindir)/d' -i "pam_ihosts-${pkgver}/Makefile.in"
}

build() {
	cd "pam_ihosts-${pkgver}"
	./configure --prefix=/usr
	make
}

package() {
	cd "pam_ihosts-${pkgver}"
	install -Dm644 LICENCE "${pkgdir}/usr/share/licenses/${pkgname}/LICENCE"
	make DESTDIR="${pkgdir}/" install
}
